package ${package_name}.enums;

import com.ruqimobility.common.dict.DataDictEnumInterface;

/**
* ${enum_annotation}类型枚举
* @author ${author}
* @date ${date}
*/
public enum ${enum_class_name}Enum implements DataDictEnumInterface{
/**${enum_annotation}类型枚举*/
<#if enum_list??>
    <#list enum_list as enum>
        ${enum.enumCode}(${enum.enumNumber},"${enum.enumName}"),
        <#if enum_index == ((enum_list?size) - 1)>;</#if>
    </#list>
</#if>


public final Integer code;

public final String desc;

${enum_class_name}Enum(Integer code, String desc) {
this.code = code;
this.desc = desc;
}

/**
* 获取code
* @param desc desc
* @return {@link Integer}
*/
public static Integer codeByDesc(String desc) {
for (${enum_class_name}Enum value : ${enum_class_name}Enum.values()) {
if (value.desc.equals(desc)) {
return value.code;
}
}
return null;
}

/**
* 获取desc
* @param code 代码
* @return {@link String}
*/
public static String descByCode(Integer code) {
for (${enum_class_name}Enum value : ${enum_class_name}Enum.values()) {
if (value.code.equals(code)) {
return value.desc;
}
}
return "";
}
/**
* 返回字典值
*/
@Override
public Object getFieldValue() {
return this.code;
}

/**
* 返回字典值描述
*/
@Override
public String getFieldValueDesc() {
return this.desc;
}
}
